PATHMac OS 8 and 9 Developer Documentation > Human Interface Toolbox > Menu Manager >

Mac OS 8 Menu Manager Reference


Menu Manager Data Types

The following Menu Manager data types are new, changed, or not recommended with Appearance Manager 1.0:


MCEntry

The menu color information table defines the standard color for the menu bar, menu titles, menu items, and the background color of a displayed menu. If you do not add any menu color entries to this table, the Menu Manager draws your menus using the current default colors. Using the menu color information table to define custom colors for your menus is not recommended with Appearance Manager 1.0 and later.

When the Appearance Manager is available and you are using standard menus, if you do not include a menu bar entry in your menu color information table, only the menu title color and menu item text color values from menu color entries are used. If you do include a menu bar entry in your menu color information table, all menu colors are used, and the menus revert to a standard System 7 appearance.

If you are creating your own custom menu definition function, all entries in the table are used.


'mctb'

The menu color information table ('mctb') resource defines the standard color for the menu bar, menu titles, menu items, and the background color of a displayed menu. If you do not add any menu color entries to this resource, the Menu Manager draws your menus using the current default colors. Using the menu color information table resource to define custom colors for your menus is not recommended with Appearance Manager 1.0 and later.

When the Appearance Manager is available and you are using standard menus, if you do not include a menu bar entry in your menu color information table resource, only the menu title color and menu item text color values from menu color entries are used. If you do include a menu bar entry in your menu color information table resource, all menu colors are used, and the menus revert to a standard System 7 appearance.

If you are creating your own custom menu definition function, all entries in the menu color information table resource are used.


'MENU'

A menu ('MENU') resource describes the initial characteristics of a menu and its menu items. With Appearance Manager 1.0,the recommended usage for certain fields of the variable-length data portion of the menu resource has been changed, and the fields may take on different values, depending on the type of information you wish to display with your menu item. However, the format of the resource remains identical.

You can provide descriptions of your menus in menu resources and use the functions GetMenu or GetNewMBar to read the descriptions of your menus. After reading in the resource description, the Menu Manager stores the information about specific menus in menu structures. When you use a menu resource to define a menu, you should check for the presence of an extended menu resource with the same resource ID.

WARNING

Menus in a resource must not be purgeable nor should they have the resource lock bit set. They must have resource ID numbers greater than 127. Do not define a "circular" hierarchical menu--that is, a hierarchical menu in which a submenu has a submenu whose submenu is a hierarchical menu higher in the chain.

Figure 1-3 shows the format of a compiled 'MENU' resource.


Figure 1-3  Structure of a compiled menu ('MENU') resource

A compiled version of a 'MENU' resource contains the following elements:

Figure 1-4 shows the variable-length data portion of a compiled 'MENU' resource that uses the standard menu definition function.


Figure 1-4  Variable-length data portion of a compiled 'MENU' resource

For the standard menu definition function, the variable-length data contains the following elements:

A menu item can have an icon or be drawn in a script other than the system script, but not both.

The values 0x01 through 0x1A as well as 0x1F and 0x20 are reserved for use by Apple; your application should not use any of these reserved values in this field.

A menu item can have a mark or a submenu, but not both.

If you provide your own menu definition function, you should use the same format for your resource descriptions of menus as shown in Figure 1-3 . You can use the same format or one of your choosing to describe menu items. You can also use bits 1-31 of the enableFlags field of the menu structure as you choose; however, bit 0 must still indicate whether the menu is enabled or disabled.


'xmnu'

You can use the extended menu ( 'xmnu' ) resource to create menus with modifier key keyboard glyphs and icons attached to menu items and Appearance-compliant menu backgrounds. The extended menu resource is available with Appearance Manager 1.0 and later.

After reading in a 'MENU' resource, GetMenu looks for an extended menu resource of type 'xmnu' with the same resource ID. The information is set for specified menu items; it is not necessary to create an extended menu entry for each item. At this point, the information can be purged or released. Figure 1-5 shows the format of a compiled 'xmnu' resource.


Figure 1-5  Structure of a compiled extended menu ('xmnu') resource

A compiled version of an 'xmnu' resource contains the following elements:

Figure 1-6 shows the format of an extended menu item entry.


Figure 1-6  Structure of an extended menu item entry

Each entry in a 'xmnu' resource corresponds to a menu item and contains the following:


Table 1-1  Keyboard font character codes

Character code

Description

0x00 Null (always glyph 1)
0x01 Unassigned (reserved for 2 bytes)
0x02 Tab to the right key (for left-to-right script systems)
0x03 Tab to the left key (for right-to-left script systems)
0x04 Enter key
0x05 Shift key
0x06 Control key
0x07 Option key
0x08 Null (always glyph 1)
0x09 Space (always glyph 3) key
0x0A Delete to the right key (for right-to-left script systems)
0x0B Return key (for left-to-right script systems)
0x0C Return key (for right-to-left script systems)
0x0D Nonmarking return key
0x0E Unassigned
0x0F Pencil key
0x10 Downward dashed arrow key
0x11 Command key
0x12 Checkmark key
0x13 Diamond key
0x14 Apple logo key (filled)
0x15 Unassigned (paragraph in Korean)
0x16 Unassigned
0x17 Delete to the left key (for left-to-right script systems)
0x18 Leftward dashed arrow key
0x19 Upward dashed arrow key
0x1A Rightward dashed arrow key
0x1B Escape key
0x1C Clear key
0x1D Unassigned (left double quotes in Japanese)
0x1E Unassigned (right double quotes in Japanese)
0x1F Unassigned (trademark in Japanese)
0x61 Blank key
0x62 Page up key
0x63 Caps lock key
0x64 Left arrow key
0x65 Right arrow key
0x66 Northwest arrow key
0x67 Help key
0x68 Up arrow key
0x69 Southeast arrow key
0x6A Down arrow key
0x6B Page down key
0x6C Apple logo key (outline)
0x6D Contextual menu key
0x6E Power key
0x6F F1 key
0x70 F2 key
0x71 F3 key
0x72 F4 key
0x73 F5 key
0x74 F6 key
0x75 F7 key
0x76 F8 key
0x77 F9 key
0x78 F10 key
0x79 F11 key
0x7A F12 key
0x87 F13 key
0x88 F14 key
0x89 F15 key
0x8A Control key (ISO standard)

© 1998 Apple Computer, Inc. - (Last Updated 19 Nov 98)